﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace IntelliTouchMix
{
    public partial class Indicators : Form
    {
        [DllImport("user32.dll")]
        static extern void mouse_event(uint dwFlags, uint dx, uint dy,
                                       uint dwData, UIntPtr dwExtraInfo);
        private const int MOUSEEVENTF_LEFTDOWN = 0x02; 
        private const int MOUSEEVENTF_LEFTUP = 0x04;
        private const int MOUSEEVENTF_RIGHTDOWN = 0x08; 
        private const int MOUSEEVENTF_RIGHTUP = 0x10;
        static float carX=0, carY=0;
        public Indicators()
        {
            InitializeComponent();
            axCarousel1.SetThumbnailSize(5);
           // CarruselPicture.Visible = false;
            // axCarousel1.SetLeftRightDir(-1);
            // axCarousel1.
        }

        private void BtnLoadDeckB_Click(object sender, EventArgs e)
        {

        }

        private void loadSampleBtn_Click(object sender, EventArgs e)
        {
           
        }

        private void leftBtn_Click(object sender, EventArgs e)
        {
            //.SelectNextControl(,,
        }

        private void rightBtn_Click(object sender, EventArgs e)
        {

        }

        private void axCarousel1_ThumbnailClick(object sender, AxCAROUSELLib._DCarouselEvents_ThumbnailClickEvent e)
        {
            String img = axCarousel1.GetThumbnailFileName(e.iThumbnailIndex);
/*            CarruselPicture.Visible = true;
            CarruselPicture.Load(img);
            CarruselPicture.BackgroundImageLayout = ImageLayout.Center;*/

         //   CarruselPicture.

            carX += 0.0f;
           // axCarousel1.ke
            axCarousel1.SetLeftRightDir(carX);
          // MessageBox.Show(img);
        }

        private void ctl3dPushButton1_Click(object sender, EventArgs e)
        {
          
        }

        private void LeftCarBtn_Click(object sender, EventArgs e)
        {
            //CarruselPicture.Hide();
            carX += 0.1f;
            axCarousel1.SetLeftRightDir(carX);
        }

        private void selectBtn_Click(object sender, EventArgs e)
        {
  Point t;
            // testControl.PointToClient(Point(Cursor.Position.X, Cursor.Position.Y));
            t = PointToScreen(new Point(Location.X+axCarousel1.Location.X + (axCarousel1.Width) / 2,Location.Y+ (axCarousel1.Height) / 2 + axCarousel1.Location.Y));
            Cursor.Position = t;
            mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP,
               (uint)t.X,
                (uint)t.Y,0, (System.UIntPtr)0); 
            SendKeys.Send("\n");
        }

        private void rightCarBtn_Click(object sender, EventArgs e)
        {
            //CarruselPicture.Hide();
            carX -= 0.1f;
            axCarousel1.SetLeftRightDir(carX);
        }

        private void ctl3dPushButton1_Click_1(object sender, EventArgs e)
        {
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter = "All Files (*.*)|*.*|PhotoShop (*.psd)|*.psd|JPEG 2000 (*.j2k)|*.j2k;*.j2c|JPEG (*.jpg)|*.jpg|PCX (*.pcx)|*.pcx|WMF (*.wmf)|*.wmf|Wireless Bitmap (*.wbmp)|*.wbmp|Bitmap (*.bmp)|*.bmp|TIF (*.tif)|*.tif|TGA (*.tga)|*.tga|Gif (*.gif)|*.gif |PGX (*.pgx)|*.pgx|RAS (*.ras)|*.ras|PNM (*.pnm)|*.pnm|PNG (*.png)|*.png|Icon (*.ico)|*.ico";
                if (ofd.ShowDialog(this) == DialogResult.OK)
                {
                    this.axCarousel1.AddThumbnail(ofd.FileName);
                    this.axCarousel1.Focus();

                }
            }
        }

        private void Indicators_Load(object sender, EventArgs e)
        {
            axCarousel1.AddThumbnail("../carrusel/sample1.png");
            axCarousel1.AddThumbnail("../carrusel/sample2.png");
            axCarousel1.AddThumbnail("../carrusel/twofx.jpg");
            axCarousel1.AddThumbnail("../carrusel/threefx.png");
            axCarousel1.AddThumbnail("../carrusel/snap.png");
            axCarousel1.AddThumbnail("../carrusel/material.jpg");
        }
    }
}
